package org.jctc.els.modules.biz.service.message.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jctc.els.modules.biz.mapper.message.MessageWaitPullMapper;
import org.jctc.els.modules.biz.service.message.IMessageWaitPullService;
import org.jctc.els.modules.biz.entity.message.MessageWaitPull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * <p>
 * 待拉取的消息表 服务实现类
 * </p>
 *
 * @author lyh
 * @since 2021-02-26
 */
@Service
public class MessageWaitPullServiceImpl implements IMessageWaitPullService {

    @Autowired
    private MessageWaitPullMapper messageWaitPullMapper;

    @Override
    public boolean save(MessageWaitPull messageWaitPull){
        return messageWaitPullMapper.insert(messageWaitPull)>0;
    }

    @Override
    public boolean remove(Long id){
        return messageWaitPullMapper.deleteById(id)>0;
    }

    @Override
    public boolean edit(MessageWaitPull messageWaitPull){
        return messageWaitPullMapper.updateById(messageWaitPull)>0;
    }

    @Override
    public  Page<MessageWaitPull> selectListByPage(Integer pageNum, Integer pageSize){
    Page<MessageWaitPull> messageWaitPullPage = new Page<>(pageNum, pageSize);
    MessageWaitPull messageWaitPull = new MessageWaitPull();

    return (Page<MessageWaitPull> )  messageWaitPullMapper.selectPage(messageWaitPullPage, Wrappers.query(messageWaitPull));
    }

    @Override
    public MessageWaitPull selectById(Long id){
        return  messageWaitPullMapper.selectById(id);
    }
}
